#include <myhead.h>
#include "print.h"

void print_nav(char* page_path){
	printf("\033[1;34;47m[当前界面]:%s\033[0m\n", page_path);
}

void print_nav2(char* page_path, char* username){
	printf("\033[1;34;47m[当前界面]:%s  [当前用户]:%s\033[0m\n", page_path, username);
}


void print_red(char* msg){
	printf("\033[1;31m%s\033[0m\n", msg);
}

void print_red2(char* str1, char* str2){
	printf("\033[1;31m%s : %s\033[0m\n", str1, str2);
}

void print_green(char* msg){
	printf("\033[1;32m%s\033[0m\n", msg);
}

void print_green2(char* msg1, char* msg2){
	printf("\033[1;32m%s : %s\033[0m\n", msg1, msg2);
}

void print_blue(char* msg){
	printf("\033[1;34m%s\033[0m\n", msg);
}

void print_blue2(char* msg1, char* msg2){
	printf("\033[1;34m%s : %s\033[0m\n", msg1, msg2);
}

void print_sys_err(char* msg){
	printf("\033[1;31m[系统消息]%s\033[0m\n", msg);
}

void print_sys_err2(char* msg1, char* msg2){
	printf("\033[1;31m[系统消息]%s : %s\033[0m\n", msg1,  msg2);
}

void print_sys_ok(char* msg){
	printf("\033[1;32m[系统消息]%s\033[0m\n", msg);
}

void print_sys_ok2(char* msg1, char* msg2){
	printf("\033[1;32m[系统消息]%s : %s\033[0m\n", msg1, msg2);
}

void print_hex(char* buf, int len, int cr){
	int i=0;
	for(i=0;i<len;i++){
		printf("%02X ", (unsigned char)buf[i]);
		if((i+1)%cr == 0){
			printf("\n");
		}
	}
	if(i % cr != 0)
		printf("\n");
}

char getInputChar(char* note){
	if(note == NULL)
		printf("[请输入]:");
	else
		printf("%s", note);
	char cmd[128];
	fgets(cmd, sizeof(cmd), stdin);
	return cmd[0];
}
